package com.myz.app.controller;

import com.myz.app.entity.User;
import com.myz.app.service.IUserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;


/**
 * Created by maoyz on 17-10-9.
 */
@Controller
@RequestMapping("/user")
public class UserControl {

    private final static Logger logger = LoggerFactory.getLogger(UserControl.class);

    @Resource
    private IUserService userService;

    @GetMapping(value = "/get/")
    @ResponseBody
    public String get(@RequestParam("name") String username){
        List<User> users = userService.getUserByName(username);
        logger.info(String.valueOf(users));
        return String.valueOf(users);
    }

}
